<template>
	<view class="mainpadding">
		<textarea class="textarea" placeholder="请输入您的留言" v-model="des"></textarea>
		<view class="bigbtn margin_top" @click="submit">提交</view>
		<view class="flexcenter margin_top">
			<view class="margin_right1">
				<u-icon name="server-man" size="28"></u-icon>
			</view>
			<view class="xiaolan nofonweight titletext" @click.stop="phone(systeminfo.kf_mobile)">{{systeminfo.kf_mobile}}</view>
		</view>
		
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				systeminfo:{},
				des:"",
			}
		},
		onLoad() {
			this.system()
		},
		methods: {
			submit(){
				if(this.des==""){
					httpRequest.toast("请输入您的留言！")
					return false
				}
				if(this.des.length<5){
					httpRequest.toast("留言内容不能小于5个字数")
					return false
				}
				httpRequest.request('/api/user/addLy','GET',{
					des:this.des
				}).then(res => {
					httpRequest.toast(res.msg)
					if(res.code==1){
						setTimeout(()=>{
							uni.navigateBack(1)
						},1000)
					}
				})
			},
			system(){
				httpRequest.request('/api/index/getConfigInfo','GET',{}).then(res => {
					this.systeminfo = res.data
				})
			},
			phone(p) {
				uni.makePhoneCall({
					phoneNumber: p.toString(),
					success(ress) {
						console.log("拨打电话成功", ress)
					},
					fail(err) {
						console.log("拨打电话失败", err)
					}
			
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.textarea{
	padding: 30rpx;
	width: 100%;
	box-sizing: border-box;
	background-color: #fff;
}
</style>
